<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>枚举</title>
    <script>
        var obj = {
            name:"飞哥",
            age:18,
            sayName:function() {
                console.log(obj.name);
            }
        };
        obj.sayName();
        // 枚举
        /*
        语法：
            for(var 变量 in 对象属性个数) {

            }
            //n表示属性名
            //对象名[n]表示各属性值
        */
        for(var n in obj) {
            document.write(n+"="+obj[n]+"<br>"); 
        }
    </script>
</head>
<body>
    
</body>
</html>